/*
 * @Author: ZhanXie
 * @Date: 2020-03-17 14:15:40
 * @LastEditors: ZhanXie
 * @LastEditTime: 2020-04-13 15:32:15
 * @Description: 
 * @FilePath: /projectStudy/js-design/nodejs/generator.js
 */
// 生成器函数
function* foo() {
  yield 1
  yield 2
  yield 3
  yield 4
  yield 5
  return 6
}
for (let v of foo()) {
  console.log(v)
}